package com.greatwall.hip.cms.service.impl;

import com.greatwall.hip.cms.dao.MedicalDiseaseDataDao;
import com.greatwall.hip.cms.entity.MedicalDiseaseData;
import com.greatwall.hip.cms.model.Req;
import com.greatwall.hip.cms.service.MedicalDiseaseDataService;
import com.greatwall.hip.cms.vo.OutpatientFrDistributedVO;
import com.greatwall.hip.cms.vo.OutpatientFxDistributedVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (MedicalDiseaseData)表服务实现类
 *
 * @author makejava
 * @since 2021-07-06 14:59:38
 */
@Service("medicalDiseaseDataService")
public class MedicalDiseaseDataServiceImpl implements MedicalDiseaseDataService {
    @Resource
    private MedicalDiseaseDataDao medicalDiseaseDataDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public MedicalDiseaseData queryById(Long id) {
        return this.medicalDiseaseDataDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<MedicalDiseaseData> queryAllByLimit(int offset, int limit) {
        return this.medicalDiseaseDataDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param medicalDiseaseData 实例对象
     * @return 实例对象
     */
    @Override
    public MedicalDiseaseData insert(MedicalDiseaseData medicalDiseaseData) {
        this.medicalDiseaseDataDao.insert(medicalDiseaseData);
        return medicalDiseaseData;
    }

    /**
     * 修改数据
     *
     * @param medicalDiseaseData 实例对象
     * @return 实例对象
     */
    @Override
    public MedicalDiseaseData update(MedicalDiseaseData medicalDiseaseData) {
        this.medicalDiseaseDataDao.update(medicalDiseaseData);
        return this.queryById(medicalDiseaseData.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.medicalDiseaseDataDao.deleteById(id) > 0;
    }

    @Override
    public MedicalDiseaseData queryStatisticsData(Req req) {
        return this.medicalDiseaseDataDao.queryStatisticsData(req);
    }

    @Override
    public List<OutpatientFxDistributedVO> outpatientFxDistributed(Req req) {
        return this.medicalDiseaseDataDao.outpatientFxDistributed(req);
    }

    @Override
    public List<OutpatientFrDistributedVO> outpatientFrDistributed(Req req) {
        return this.medicalDiseaseDataDao.outpatientFrDistributed(req);
    }

}
